# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_library(
    name = "ecc",
    deps = [
        "//yacl/crypto/ecc/FourQlib",
        "//yacl/crypto/ecc/lib25519",
        "//yacl/crypto/ecc/libsodium",
        "//yacl/crypto/ecc/mcl:ecc",
        "//yacl/crypto/ecc/openssl",
        "//yacl/crypto/ecc/toy",
    ],
)

yacl_cc_library(
    name = "spi",
    srcs = [
        "ecc_spi.cc",
        "group_sketch.cc",
    ],
    hdrs = [
        "ecc_spi.h",
        "group_sketch.h",
    ],
    deps = [
        ":curve_meta",
        ":ec_point",
        "//yacl/base:byte_container_view",
        "//yacl/math/mpint",
        "//yacl/utils/spi",
    ],
)

yacl_cc_library(
    name = "ec_point",
    srcs = [
        "ec_point.cc",
    ],
    hdrs = [
        "ec_point.h",
    ],
    deps = [
        ":any_ptr",
        "//yacl/math/mpint",
    ],
)

yacl_cc_library(
    name = "any_ptr",
    hdrs = ["any_ptr.h"],
    deps = ["//yacl/base:exception"],
)

yacl_cc_library(
    name = "curve_meta",
    srcs = [
        "curve_meta.cc",
    ],
    hdrs = [
        "curve_meta.h",
    ],
    deps = [
        "//yacl/base:exception",
        "@com_google_absl//absl/strings",
    ],
)

yacl_cc_test(
    name = "ecc_test",
    srcs = [
        "ecc_test.cc",
    ],
    deps = [
        ":ecc",
        "@com_github_fmtlib_fmt//:fmtlib",
        "@yacl//yacl/utils:parallel",
    ],
)
